<style>
.content-group {background:#fff;border-radius: 0.5rem;margin-bottom:0.39rem}
.merchname {display:none}
.fui-icon-group .fui-icon-col {
    margin: 0.3rem 0;
}
.carousel {margin-top:0}
.fui-header:after {
	border-bottom: 0 solid #D9D9D9;
}
.fui-notice:after, .fui-notice:before  {
	border-bottom: 0 solid #D9D9D9;
	border-top: 0 solid #D9D9D9;
}
.bottombg {position: absolute;margin-top:-0.5rem;width:100%;height:0.5rem;border-top-right-radius:0.5rem;border-top-left-radius:0.5rem;}
.topbg {height:2.8rem;}
.topbg.nosearch{height:2rem;}
.search-input i {
    color: {{main.syscolor||'#b4b4b4'}};
}
.search-input input {
	border: 0 solid #b4b4b4;
}
.jylabels {
    display: inline;
    padding: 0 0.5rem;
    margin: 0.2rem;
    font-size: 0.55rem;
    line-height: 1.1rem;
    text-align: center;
    border-radius: 0.6rem;
}
</style>
<div ng-include="sys_html('common/_header','','','jy_weishop')"></div>
<div ng-if="pagedata.isshowarea!=1" class="fui-page fui-page-current page-goods-list">
<div class='fui-content' style="top:0">
	<div class="topbg" style="position: relative;text-align:center;width:100%;background: {{main.syscolor || '#7c1cc9'}};">
		<div class="fui-header" style="background:none">
			<div class="fui-header-left" style="padding-left:0.5rem">
				<img style="height:1.2rem" ng-src="{{tomedia(pagedata.setting.toplogo) || '../addons/jy_merchfuwu/resource/images/logo.png'}}"/>
			</div>
			<div class="fui-header-right" style="line-height: 2.4rem;padding-right:0.5rem;color:#fff">
				<span class="overflow-h" style="margin-right:0.2rem;">
					<i class="icon jinyunicon icon-map"></i>
					<span style="width:6rem;overflow: hidden">{{pagedata.pcd.district||'默认上门地址'}}</span>
				</span>
				<i class="icon icon-saoyisao1" ng-click="pagedata.scancode()" style="font-size: 0.8rem;margin-right:0.2rem"></i>
				<i class="icon icon-fenxiang2" onclick="$('#showsharecover').modal();" style="font-size: 0.85rem;margin-right:0.2rem"></i>
				<i class="icon icon-liaotian" ng-click="access_json('jy_merchfuwu/member.index/')" style="font-size: 0.9rem;"></i>
			</div>
		</div>
	</div>
	<div class="bottombg" style="background:#fff;"></div>
	<div style="background:#fff;">
	<div class="fui-cell-group" style="margin-top:0">
				<div class="fui-cell" style="padding:0 0.5rem">
					<div class="fui-cell-label" ng-click="pagedata.isshowarea=1;">
						<span style="font-size:0.75rem">{{pagedata.pcd.city || '全国'}}</span>
						<i class="icon jinyunicon icon-moreunfold"></i>
					</div>
					<div class="fui-cell-info search-input">
						<i id="searchsub" class="fa fa-search" ng-click="access_json('jy_merchfuwu/goods.index//keyword='+pagedata.params.keyword)"></i>
						<input type="search" placeholder="输入关键字..." class="search" style="border-radius: 1rem;background-color:#f2f2f2" ng-model="pagedata.params.keyword">
					</div>
				</div>
	</div>
	<div class="fui-tab-scroll">
		<div class="item" ng-repeat="(k,v) in pagedata.pluginset.keyword">
			<div class="jylabels jylabel-f3f3f3" style="line-height:1.4;margin:0.3rem 0;padding: 0.2rem 0.5rem 0.2rem;" ng-click="access_json('jy_merchfuwu/goods.index//keyword='+v)">{{v}}</div>
		</div>
	</div>
	</div>
	<div ng-if="pagedata.params.pid==0 && !pagedata.setting.ishdps" ng-include="sys_html('shop/_hdps','','','jy_weishop')" class="radius" style="padding:0 0.5rem;margin-top:0.4rem"></div>
	<div ng-if="pagedata.params.pid==0 && !pagedata.setting.isbao" style="padding: 0.3rem;padding-bottom:0;width:100%">
		<span style="font-size:0.65rem"><img style="height:1rem;margin-top:-0.1rem" src="../addons/jy_merchfuwu/resource/images/shi.png"/> 时效保障</span>
		<span style="font-size:0.65rem"><img style="height:1rem;margin-top:-0.1rem"src="../addons/jy_merchfuwu/resource/images/fuwu.png"/> 服务保障</span>
		<span style="font-size:0.65rem"><img style="height:1rem;margin-top:-0.1rem"src="../addons/jy_merchfuwu/resource/images/zhuan.png"/> 质量保障</span>
		<span style="font-size:0.65rem"><img style="height:1rem;margin-top:-0.1rem"src="../addons/jy_merchfuwu/resource/images/gou.png"/> 价格保障</span>
	</div>
	<div ng-if="pagedata.params.pid==0 && !pagedata.setting.isswiper" style="padding: 0.5rem;padding-bottom:0;width:100%">
		<div class="bgnone" ng-include="sys_html('common/_swiper','','','jy_mfuwu')"></div>
	</div>
	<div ng-if="pagedata.params.pid==0 && !pagedata.setting.isnotice" ng-include="sys_html('shop/_notice','','','jy_mfuwu')" class="radius" style="padding:0 0.5rem;"></div>
	<div ng-if="pagedata.params.pid==0 && !pagedata.setting.iscube" class="radius" ng-include="sys_html('shop/_fangcube','','','jy_weishop')"></div>
	<div class="fui-tab-scroll" style="margin-top:0;padding-left:0.5rem">
		<div ng-class="{'item':1,'on':!pagedata.showgoods}" style="height:2rem;line-height:2rem"><a href="javascript:;" ng-click="pagedata.getlist('merch');pagedata.showgoods=false">附近商家</a></div>
		<div ng-class="{'item':1,'on':pagedata.showgoods}" style="height:2rem;line-height:2rem"><a href="javascript:;" ng-click="pagedata.getlist('goods');pagedata.showgoods=true">猜你喜欢</a></div>
	</div>
	<div class="fui-list-group" style="margin-top:0;background:none;padding:0 0.6rem">
				<ul class="fui-list" style="font-size:0.65rem;padding:0 0.5rem">
					<li ng-click="pagedata.golist('showlist',0);" class="fui-list-inner bold"><span>综合排序</span><i class="icon icon-moreunfold"></i></li>
					<li ng-click="pagedata.golist('showlist',1);" class="fui-list-inner"><span>商户品类</span><i class="icon icon-moreunfold"></i></li>
					<li ng-click="pagedata.golist('showlist',2);" class="fui-list-inner"><span>服务评分</span><i class="icon icon-moreunfold"></i></li>
					<li ng-click="pagedata.golist('showlist',3);" class="fui-list-inner"><span>全部筛选</span><i class="icon icon-moreunfold"></i></li>
				</ul>
	</div>
	<div ng-if="!pagedata.showgoods" class="fui-list-group merchgroup" style="background:none;">
				<div ng-include="sys_html('common/_merchlist','','','jy_mfuwu')"></div>
				<div ng-if="!loading && (!pagedata.list || pagedata.list.length<1)" class='content-empty' style="margin-top:0">
					<i class='icon icon-lianxishangjia'></i>
					<div>暂时没有任何商户</div>
				</div>
	</div>
	<div ng-if="pagedata.showgoods" class="fui-goods-group block">
				<div ng-include="sys_html('common/_goodslist','','','jy_mfuwu')"></div>
	</div>
	<div ng-show="loading" class='infinite-loading'><span class='fui-preloader'></span><span style="margin-left:1.5rem"> 正在加载...</span></div>
	<div ng-include="sys_html('common/_copyright',true)"></div>
</div>
</div>
<div ng-include="sys_html('common/_search','','','jy_mfuwu')"></div>
<div ng-include="sys_html('common/_share','','','jy_weishop')"></div>
<div ng-include="sys_html('common/_sales','','','jy_weishop')"></div>
<div ng-include="sys_html('common/_footer')"></div>
<div ng-if="pagedata.nodatapic_close" ng-include="sys_html('common/_coupon',true)"></div>
<div ng-if="pagedata.nodatapic_close" ng-include="sys_html('common/_h5game',true)"></div>
<div ng-include="sys_html('common/_gotop',true)"></div>
<div ng-include="sys_html('common/_welcomehdp',true)"></div>
<!--弹目-->
<div ng-if="pagedata.showtanmus && !pagedata.pluginset.no_tanmu" class="video-sms-pane {{pagedata.transition?'transition':''}}">
		<div class="video-sms-text">
			<image class="video-sms-logo" ng-src="{{pagedata.tanmus[pagedata.nowmsgid].avatar}}"/>
			<span class="overflow-h"> 最新订单来自 {{pagedata.tanmus[pagedata.nowmsgid].nickname}}</span>
		</div>
</div>
<script>
scope.pagedata.issocketmsg=false;
scope.pagedata.tanmuspage=0;
scope.pagedata.isa2=true;
scope.pagedata.isno_coupontop=1;
scope.pagedata.gettanmus=function() {
	if(!scope.pagedata.issocketmsg){
			scope.pagedata.nowmsgid=0;
			scope.get('jy_weishop/get_data/gettanmus/page='+scope.pagedata.tanmuspage,function(res){
						//console.log(res);
						scope.pagedata.tanmus=res.list
						if(scope.pagedata.tanmus.length>0){
							scope.pagedata.tanmuspage++;
							scope.pagedata.up_oldtanmu();
						}
			});
	}
}
//前端先注册以等待接收消息
require(['jinyun_socket'],function(jinyun_socket){	
    jinyun_socket.connect(function(res){
			console.log('加入ID为index的组：');console.log(res);
            jinyun_socket.join('index');//加入ID为1的组
     });	 
    jinyun_socket.onsystem=function(res){
        console.log('收到来自后端的消息：');console.log(res);
		scope.pagedata.issocketmsg=true;
		if(scope.pagedata.setting.no_tanmu!=1){
			set_tanmu(res.nickname,res.avatar,res.time);
		}
    }
	//刚进入时；如果没有新订单消息，就弹储备订单消息
	if(scope.pagedata.setting.no_tanmu!=1){
		setTimeout(function(){
			scope.pagedata.gettanmus();
		},2000);
	}
});
scope.pagedata.up_oldtanmu=function() {
		if(scope.page.action=='index'){
			var i=scope.pagedata.nowmsgid;
			if(i<scope.pagedata.tanmus.length){
				set_tanmu(scope.pagedata.tanmus[i].nickname,scope.pagedata.tanmus[i].avatar,scope.pagedata.tanmus[i].time);
			}else{
				scope.pagedata.gettanmus();
			}
		}else{
			return false;
		}
}
function set_tanmu(nickname,avatar,time) {
		scope.pagedata.nowmsgid++
		scope.pagedata.showtanmus=true
		scope.$evalAsync(scope.pagedata.showtanmus);
		setTimeout(function(){
			scope.pagedata.transition=true
			scope.$evalAsync(scope.pagedata.transition);	
		},300);
		setTimeout(function(){
			scope.pagedata.showtanmus=false
			scope.pagedata.transition=false
			scope.$evalAsync(scope.pagedata.showtanmus);	
		},2000);
		setTimeout(function(){
			//等待5秒，如果没有新的订单消息，就弹储备订单消息
			scope.pagedata.issocketmsg=scope.pagedata.issocketmsg?scope.pagedata.issocketmsg:false;
			if(!scope.pagedata.issocketmsg && scope.page.action=='index'){
				scope.pagedata.up_oldtanmu();
			}
		},4000);
}
// 百度地图API功能
if(!scope.pagedata.lat_lng){
	window.scope.location(function(re){
		//console.log(re);
		if(re.lat_lng){
			scope.pagedata.pcd=re.addressComponents;
			scope.pagedata.pcd.street=scope.pagedata.pcd.street_recommend?scope.pagedata.pcd.street_recommend:scope.pagedata.pcd.street;
		}
	});
}
//手机软键盘--搜索
$("body").keydown(function() {
    if (event.keyCode == "13") {
        $('#searchsub').click();
    }
});
scope.pagedata.scancode=function () {
			console.log('scanQRCodeOK');
			wx.scanQRCode({
				needResult: 1, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
				scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码，默认二者都有
				success: function (res) {
					var result = res.resultStr; // 当needResult 为 1 时，扫码返回的结果
					location.href = result;
				}
			});
}
</script>
<script type="text/javascript">
scope.pagedata.post={'sendtype':1,'dayid':0}
scope.pagedata.getlist=function(type,order){
	scope.pagedata.isgolist = false;
	scope.pagedata.params.page=1;
	scope.pagedata.params.order=order?order:'';
	scope.loading=true;
	setTimeout(function(){
		scope.loading=false;
		scope.$evalAsync();
	},500);	
	if(type=='goods'){		
		scope.tool.get_list('jy_merchfuwu/index/getgoods/',true)
	}else{
		scope.tool.get_list('jy_merchfuwu/index/getmerchs/',true)
	}
}
scope.pagedata.getlist();
scope.pagedata.scroll_bottom=function(){
		if(scope.pagedata.showgoods){
			scope.tool.get_list('jy_merchfuwu/index/getgoods/');
		}else{
			scope.tool.get_list('jy_merchfuwu/index/getmerchs/');
		}
}
scope.pagedata.golist=function(id,paramstype){
	scope.pagedata.isgolist = true;
	scope.pagedata.paramstype = paramstype;
	scope.$evalAsync();
}
</script>